﻿using System;
using System.Runtime.CompilerServices;
using System.Web.UI;
using System.ComponentModel;

namespace TA.Turbo.Controls
{
	/// <summary>
	/// Base class for all text buttons.
	/// </summary>
	public abstract class BaseButton : BaseCommandControl
	{
		#region PUBLIC
		#region INIT
		/// <summary>
		/// Ctor.
		/// </summary>
		public BaseButton()
		{
			this.Text = "";
		}
		#endregion
		#region PROPS
		#region DEF
		/// <summary>
		/// props.
		/// </summary>
		protected static new Properties _clientProperties = Define(BaseCommandControl._clientProperties, new[] {
			new PropertyDefinition<string>("Text", "Tx", null) { IsHTML = true },
		});
		/// <summary>
		/// props.
		/// </summary>
		public override Properties ClientProperties
		{
			get
			{
				return _clientProperties;
			}
		}
		#endregion
		/// <summary>
		/// Text to be displayed in the button.
		/// </summary>
		[PersistenceMode(PersistenceMode.Attribute)]
		[DefaultValue("")]
		[Category("Appearance")]
		public string Text
		{
			get
			{
				return GetProperty<string>("Text");
			}
			set
			{
				ViewState["Text"] = value;
			}
		}
		/// <summary>
		/// When implemented, gets or sets non-typed value.
		/// </summary>
		public override object GenericValue
		{
			get
			{
				return this.Text;
			}
			set
			{
				this.Text = (string)value;
			}
		}
		/// <summary>
		/// Gets or sets the serialized value - in the format that is suitable for client-server transfers.
		/// </summary>
		protected internal override string SerializedValue
		{
			get
			{
				return this.Text;
			}
			set
			{
				this.Text = value;
			}
		}
		#endregion
		#endregion
	}
}

